nums=[3,0,1]
def missingNumber(nums):
    n=len(nums)
    state=[False for _ in range(n+1)]
    for i in nums:
        state[i]=True

    for i in range(len(state)):
        if state[i]==False:
            return i

print(missingNumber(nums))